const jwt = require('jsonwebtoken')

let token = jwt.sign(
  {
    username: 'zhangsan'
  },
  'tangfangze',
  {
    expiresIn: 60 * 60
  }
)

// console.log(token)

let t =
  'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InpoYW5nc2FuIiwiaWF0IjoxNzA5NDcyNzE4LCJleHAiOjE3MDk0NzYzMTh9.3U0E3xuWdn5OETIy8mckXiKWh1EHQXKdY9Sfto17G_0'

jwt.verify(t, 'tangfangze', (err, data) => {
  if (err) {
    console.log('校验失败')
    return
  }
  console.log(data)
})
